<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
	<meta name="viewport" content="user-scalable=no,viewport-fit=cover" />
	<link href="./css/baseCss.css" rel="stylesheet" type="text/css"/>
	<link href="./css/detailMerchant.css" rel="stylesheet" type="text/css"/>
	<link href="./base/layer.css" rel="stylesheet" type="text/css"/>
	<!-- <link href="./base/articlecon.css" rel="stylesheet" type="text/css"/> -->
	<link href="./base/base2.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="./css/swiper-3.4.0.min.css">
	<script type="text/javascript" src="./base/rem.js"></script>
	<script type="text/javascript" src="./base/iscroll.js"></script>
	
	<!-- <link rel="stylesheet" type="text/css" href="./css/detail.css"> -->
	<style type="text/css">
		
	</style>
	<title>餐厅详情页-商家</title>
</head>
<body>
	<div class="container">
		<div class="detail-top">
			<div class="detail-top-bg">
				<img class="bgImg" src="./img/bg_01.png">
				<!-- <div class="detail-top-love"><img src="./img/heart_01.png"><img src="./img/share_01.png"></div> -->
			</div>
			<div class="detail-top-name name">欢乐汇餐厅</div>
			<div  class="detail-top-prefer"><span class="prefer">满减</span><span>满20减2;</span><span>满30减4;</span><span>满50减7</span></div>
			<div class="detail-top-size">
				<span>味道赞</span><span>包装好</span><span>价格实惠</span><span>服务好</span>
			</div>
			<div><img class="logoImg" src="./img/root_03.png"></div>
		</div>
		<div class="detail-bar">
			<div class="detail-sw">
				<div onclick="detailDis('detail');">点菜</div><div onclick="detailDis('detailComment');">评价</div><div class="detail-current">商家</div>
			</div>
			<div class="detail-dish">
				<div class="merchant">
					<div>
						<div class="merchant_infor merchant_inc">
							<div class="merchant_title">商家信息</div>
							<div class="merchant_imgs">
								<!-- <span class="merchant_img"><img class="imgBai" src="./img/res_01.png"></span>
								<span class="merchant_img"><img class="imgBai" src="./img/res_01.png"></span> -->
							</div>
						</div>
					</div>
					<div>
						<div class="merchant_inc">
							<div class="merchant_title">商家名称</div>
							<div class="merchant_text name">欢乐汇餐厅</div>
						</div>
					</div>
					<div>
						<div class="merchant_inc">
							<div class="merchant_title">商家品类</div>
							<div class="merchant_text">川湘菜</div>
						</div>
					</div>
					<div>
						<div class="merchant_inc">
							<div class="merchant_title">商家地址</div>
							<div id="merchantAddress" class="merchant_text">
								<div>深圳</div>
								<div>罗湖</div>
							</div>
						</div>
					</div>
					<div>
						<div class="merchant_inc">
							<div class="merchant_title">商家电话</div>
							<span class="merchant_return"><img src="./img/return_03.png"></span>
							<div class="merchant_text phone">13623287223</div>
						</div>
					</div>
					<div>
						<div class="merchant_inc">
							<div class="merchant_title">营业时间</div>
							<div class="merchant_text businessHour">08:00-24:00</div>
						</div>
					</div>
					<div>
						<div class="merchant_qua merchant_inc" onclick="detailDis('business');">
							<div class="merchant_title">商家资质</div>
							<span class="merchant_return"><img src="./img/return_03.png"></span>
						</div>
					</div>
				</div>
				<!-- <div><button class="report">举报商家</button></div> -->
			</div>
		</div>
	</div>
</body>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/httpUnit.js"></script>
<script type="text/javascript" src="./js/constants.js"></script>
<script type="text/javascript">
	findRestQualification();
	//餐厅信息
    function findRestQualification(){
        var Request = new Object();
        Request = GetRequest();
        var restaurantId = Request['id'];

        var obj = JSON.stringify({
            "id": restaurantId,
        });
        httpHelperpost(_API_GETRESTAURANT_INFO, obj, function(isSuccess, data) {
            if (isSuccess == true) {
                var response = data.responseText;
                var value = JSON.parse(response);
                    
                console.log(response);
                $(".name").text(value.data.name);
                $(".logoImg").attr("src",value.data.icon);
                var amBusinessHourStart = value.data.amBusinessHourStart;
                amBusinessHourStart = amBusinessHourStart.substring(0,amBusinessHourStart.length-3);
                var amBusinessHourEnd = value.data.amBusinessHourEnd;
                amBusinessHourEnd = amBusinessHourEnd.substring(0,amBusinessHourEnd.length-3);
                var pmBusinessHourStart = value.data.pmBusinessHourStart;
                pmBusinessHourStart = pmBusinessHourStart.substring(0,pmBusinessHourStart.length-3);
                var pmBusinessHourEnd = value.data.pmBusinessHourEnd;
                pmBusinessHourEnd = pmBusinessHourEnd.substring(0,pmBusinessHourEnd.length-3);
                var ngBusinessHourStart = value.data.ngBusinessHourStart;
                ngBusinessHourStart = ngBusinessHourStart.substring(0,ngBusinessHourStart.length-3);
                var ngBusinessHourEnd = value.data.ngBusinessHourEnd;
                ngBusinessHourEnd = ngBusinessHourEnd.substring(0,ngBusinessHourEnd.length-3);
                $(".businessHour").html("<div>"+amBusinessHourStart+"~"+amBusinessHourEnd+"</div><div>"+pmBusinessHourStart+"~"+pmBusinessHourEnd+"</div><div>"+ngBusinessHourStart+"~"+ngBusinessHourEnd+"</div>")
                $(".phone").text(textisNull(value.data.phone));
                $("#merchantAddress").html("<div>"+value.data.address+"</div><div>"+textisNull(value.data.houseNumber)+"</div>");
                if(value.code == 0){
                    console.log("查询成功");
                    
                }else if(value.code==401){
	            	alert(value.message);
	            	window.location.href='./index.html';
	            }else{
                	alert(value.message);
                    console.log("查询失败");
                }
            }else {}
        });
    }
	function detailDis(url){
		var Request = new Object();
        Request = GetRequest();
        var id = Request['id'];
        window.location.href = './'+url+".html?id="+id;
	}

	function textisNull(value){
		if(value==null||value==undefined){
			value ="";
		}
		return value;
	}

	//获取url中"?"符后的字串
    function GetRequest() {
        var url = location.search; //获取url中"?"符后的字串   
        
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
          var str = url.substr(1);
          
          strs = str.split("&");
          
          for (var i = 0; i < strs.length; i++) {
            
            theRequest[strs[i].split("=")[0]] = strs[i]
                .split("=")[1];
          }
        }
        return theRequest;
    }
	
</script>
</html>